import { timeout } from "q";

/**
 * 通用的loding
 * @Author: byx
 * @Date: 2019-10-12
 * @Last Modified by:
 * @Last Modified time:
 */

export default {
	data(){
		return {
			loding_defOptions: {	// 声明一个loading对象
				lock: true, // 是否锁屏
				fullscreen: false,
				body: false,
				target: '.___maxLodingBox_', // 需要遮罩的区域
			}
			// defOptions = Object.assign(defOptions,options);

		};
	},
	mounted(){
		// this.$nextTick(()=> {
		// 	console.log(".lodingBox ->",document.querySelectorAll(".lodingBox"));
		// 	document.querySelectorAll(".lodingBox").forEach(e => {
		// 		let __this = e.__vue__;
		// 		//开关对象
		// 		let loding = __this.$attrs.loding;
		// 		//获取配置
		// 		let option = __this.$attrs.option || {};
		// 		option = Object.assign({},this.loding_defOptions,option);
		// 		option.target = e;
		// 		let __vm =  __this.$loading(option);
		// 		__this.__LodingVm = __vm;
		// 		this.$nextTick(()=> {
		// 			console.log('loding ->',loding)
		// 			// __vm.visible = loding;
		// 			__vm.$set(__vm,'visible',loding);
		// 		});
		// 	});
		// });
	},
	methods:{
		openLoding(target,option){
			option = Object.assign({},this.loding_defOptions,option);
			if(target){
				option.target = target;
			}
			return this.$loading(option);
		},
		closeLoding(loading){
			if(loading){
				loading.close();
			}
		}
	}



}
